package com.hdb;

import com.hdb.dao.Hidden;
import com.hdb.dao.NeedFilter;

import javax.persistence.*;

/**
 * Created by aszer on 2016/11/12.
 */
@NeedFilter
@Entity
@Table(name = "user", schema = "testin", catalog = "")
public class TUser {
    private int userId;
    private String userName;
    @Hidden
    private String userPw;
    private String userEmail;
    private String userRealName;
    private int userSex;
    private String userTel;
    private String userQq;

    @Id
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "user_name", nullable = false, length = 32)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "user_pw", nullable = false, length = 256)
    public String getUserPw() {
        return userPw;
    }

    public void setUserPw(String userPw) {
        this.userPw = userPw;
    }

    @Basic
    @Column(name = "user_email", nullable = false, length = 128)
    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    @Basic
    @Column(name = "user_real_name", nullable = false, length = 32)
    public String getUserRealName() {
        return userRealName;
    }

    public void setUserRealName(String userRealName) {
        this.userRealName = userRealName;
    }

    @Basic
    @Column(name = "user_sex", nullable = false)
    public int getUserSex() {
        return userSex;
    }

    public void setUserSex(int userSex) {
        this.userSex = userSex;
    }

    @Basic
    @Column(name = "user_tel", nullable = true, length = 32)
    public String getUserTel() {
        return userTel;
    }

    public void setUserTel(String userTel) {
        this.userTel = userTel;
    }

    @Basic
    @Column(name = "user_qq", nullable = true, length = 16)
    public String getUserQq() {
        return userQq;
    }

    public void setUserQq(String userQq) {
        this.userQq = userQq;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TUser tUser = (TUser) o;

        if (userId != tUser.userId) return false;
        if (userSex != tUser.userSex) return false;
        if (userName != null ? !userName.equals(tUser.userName) : tUser.userName != null) return false;
        if (userPw != null ? !userPw.equals(tUser.userPw) : tUser.userPw != null) return false;
        if (userEmail != null ? !userEmail.equals(tUser.userEmail) : tUser.userEmail != null) return false;
        if (userRealName != null ? !userRealName.equals(tUser.userRealName) : tUser.userRealName != null) return false;
        if (userTel != null ? !userTel.equals(tUser.userTel) : tUser.userTel != null) return false;
        if (userQq != null ? !userQq.equals(tUser.userQq) : tUser.userQq != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = userId;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (userPw != null ? userPw.hashCode() : 0);
        result = 31 * result + (userEmail != null ? userEmail.hashCode() : 0);
        result = 31 * result + (userRealName != null ? userRealName.hashCode() : 0);
        result = 31 * result + userSex;
        result = 31 * result + (userTel != null ? userTel.hashCode() : 0);
        result = 31 * result + (userQq != null ? userQq.hashCode() : 0);
        return result;
    }
}
